package com.fuzongle.tenant;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

import static org.springframework.boot.WebApplicationType.SERVLET;

@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class SpringBootTenantApplication {
    private static final Logger log = LoggerFactory.getLogger(SpringBootTenantApplication.class);

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = new SpringApplicationBuilder(SpringBootTenantApplication.class).web(SERVLET).run(args);
        Environment env = application.getEnvironment();
        log.info("\n----------------------------------------------------------\n\t" +
                        "miracle-admin 项目运行成功! 访问连接:\n\t" +
                        "后台地址: \thttp://{}:{}/API地址\n" +
                        "----------------------------------------------------------",
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port"));
    }
}
